import {getIndicator} from '../../js/my-public'
import {_ANIME_PATH_} from '../../js/my-core'

export const getIndicators = (_this) => {
  getIndicator(_this, 0)
}

export const getRecentAnimeVideos = (_this) => {
  _this.$axios({
    method: 'get',
    url: '/api/anime/recent/8'
  })
    .then((res) => {
      if (res.data.code === 200) {
        let id = 0
        for (let item of res.data.data) {
          if (id === 0 || id === 1) {
            _this.videoList1[id].data.no = item.no
            _this.videoList1[id].data.cover = item.cover
            _this.videoList1[id].data.count = item.count
            const href = _ANIME_PATH_ + item.id
            _this.videoList1[id].data.href = href
            _this.videoList1[id].data.name = item.name
          } else {
            _this.videoList4[id - 2].data.no = item.no
            _this.videoList4[id - 2].data.cover = item.cover
            _this.videoList4[id - 2].data.count = item.count
            const href = _ANIME_PATH_ + item.id
            _this.videoList4[id - 2].data.href = href
            _this.videoList4[id - 2].data.name = item.name
          }
          id++
        }
      } else {
        console.log(res.data.msg)
      }
    })
    .catch((error) => {
      console.log(error)
    })
}
